from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import set_cutscene

class DellarocasRoom(Room):
    def __init__(self, room_id ):
        Room.__init__(self, room_id)    # do basic initialization for every room
        
        # add inventory items
        
        # build list of actions
        self.add_action(Fight)
        self.add_action(Exit)
    
    # return description of room.
    def get_description(self):
        return "You walked into the big empty room, only to find..."
    
    # return image of room
    def get_image(self):
        return 'DellarocasRoom.jpg'

    def update_powerpivot(self):
        self.add_action(Skip)
        
class DellarocasRoomHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return DellarocasRoom

class Fight(Action):
    def __init__(self):
        Action.__init__(self, "Fight")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Challenge Professor Dellarocas!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'firstFloorArena'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class Exit(Action):
    def __init__(self):
        Action.__init__(self, "Exit")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Turn around and run!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'firstFloor'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"
    
class Skip(Action):
    def __init__(self):
        Action.__init__(self, "Skip")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Use Powerpivot"

    # set cutscene for when arrive in entrance_hall
    def do_action(self,game,room,request):
        set_cutscene("Your powerpivot skills mystify Dellarocas and he lets you pass")
        return
        
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'firstFloorTreasure'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"       